#
#
#

!include config.bcc

PRONAME = fastconv

SRCDIR  = source
INCDIR  = include

##### settings #######
OBJS  = $(OBJDIR)\fcnv_base.obj \
        $(OBJDIR)\fcnv_strlen.obj


##### Compiler flag settings #####

CFLAGS = $(CFLAGS_BASE) -tWD -I$(INCDIR) -I$(SRCDIR) -DBUILD_FASTCONV_LIB
LFLAGS = $(LFLAGS_BASE) -Tpd -aa

# target description #

debug:
    $(MAKE) -DBUILD=debug    -f Makefile.bcc.mak  libfiles
release:
    $(MAKE) -DBUILD=release  -f Makefile.bcc.mak  libfiles

libfiles:   mk_dir \
            $(BINDIR)\$(PRONAME).lib \
            $(BINDIR)\$(PRONAME).dll \
            $(BINDIR)\testfcnv.exe

$(BINDIR)\$(PRONAME).lib: $(BINDIR)\$(PRONAME).dll
    $(IMPLIB) -a -c -f $@ $**

$(BINDIR)\$(PRONAME).dll: $(OBJS) $(SRCDIR)\borland.def
    $(LINK) $(LFLAGS) c0d32.obj $(OBJS), $(BINDIR)\$(PRONAME).dll, , import32.lib cw32mti.lib, $(SRCDIR)\borland.def

{$(SRCDIR)\}.c{$(OBJDIR)\}.obj:
    $(CC) $(CFLAGS) -o$(OBJDIR)\$&.obj $<

$(BINDIR)\testfcnv.exe: $(BINDIR)\$(PRONAME).lib
    $(CC) -I$(INCDIR) -I$(SRCDIR) -tWC -tWR -c $(SRCDIR)\testfcnv.c $(BINDIR)\$(PRONAME).lib
    $(LINK) -Tpe -ap c0x32.obj $(SRCDIR)\testfcnv.obj , $(BINDIR)\testfcnv.exe, , import32.lib cw32mti.lib $(BINDIR)\$(PRONAME).lib

##########################################################
mk_dir:
    if not exist $(OBJDIR) mkdir $(OBJDIR)
clean:
    @echo Removing ...
    @-del $(OBJDIR)\*.obj
    @-del *.obj
    @-del *.exe
    @-del *.dll
    @-del *.lib
    @-del *.ilc
    @-del *.ild
    @-del *.ilf
    @-del *.ils
    @-del *.exp
    @-del *.tds
    @-del *.map
    @echo clean finished.

